<template>
  <el-drawer
    ref="drawerBox"
    v-bind="$attrs"
    :wrapper-closable="true"
    :close-on-press-escape="false"
    :title="title"
    :size="showMobilePage?'100%':'80%'"
    append-to-body
    v-on="$listeners"
  >
    <div class="drawer-content">
      <filter-input
        v-model="paramsObj"
        :filter-list="filterList"
        show-search-btn
        line-feed
        @handelClick="queryClick"
        @queryEmpty="queryEmpty"
      />
      <el-tabs v-if="multiple" v-model="curTabName" type="card" class="contract-detail-tabs-container" style="margin: 8px 0px" @tab-click="onSubActiveOrderChange">
        <el-tab-pane :label="isShowOther?'可见合同':'合同列表'" name="all"/>
        <el-tab-pane v-if="isShowOther" name="other">
          <div slot="label">
            <span>不可见合同</span>
            <el-tooltip :open-delay="800" placement="top" effect="dark">
              <div slot="content" style="max-width: 210px">可通过创建人、审批人操作抄送后可见</div>
              <tipIcon is-diy style="position:relative;top:2px;"/>
            </el-tooltip>
          </div>
        </el-tab-pane>
        <el-tab-pane v-if="!hideSelectTab" name="selected">
          <div slot="label" class="flex-center">已选择合同<el-badge v-if="selectedData.length" :value="selectedData.length" /></div>
        </el-tab-pane>
      </el-tabs>
      <div :style="multiple?'':{marginTop: '17px'}" class="table-list">
        <div v-loading="listLoading">
          <template v-if="(isAllTab && list.items.length > 0) || (isOtherTab && otherList.length) || (isSelectedTab && selectedData.length > 0)">
            <u-table
              ref="legalTableRef"
              :data="isAllTab?list.items:(isOtherTab?otherList:selectedTableData)"
              :row-class-name="(data) => tableRowClassName(data)"
              :height="setTableHeight"
              :border="true"
              class="fb-table"
              beautify-table
              header-drag-style
              header-cell-class-name="order-data-header-cell"
              element-loading-text="加载中..."
              empty-text="暂无数据"
              fit
              select-callback
              hightlight-current-rowref="tableRef"
              @sort-change="sortMethod"
              @select="selectTable"
              @select-all="selectTable">
              <u-table-column
                v-if="multiple && !hideSelectTab"
                fixed="left"
                align="center"
                type="selection"
                width="50"
              />
              <u-table-column v-else-if="!hideSelectTab" fixed="left" align="center" label="" min-width="50">
                <template slot-scope="scope">
                  <el-radio v-model="singleSelectId" :label="scope.row.id" @change="changeRadio($event, scope.row)"><span/></el-radio>
                </template>
              </u-table-column>
              <u-table-column align="left" label="项目名称" min-width="150">
                <template slot-scope="scope">
                  <el-tooltip v-if="isAllTab" :open-delay="800" placement="top" effect="dark">
                    <div slot="content" style="max-width: 200px;">{{ scope.row.contractName || '--' }}</div>
                    <div class="ellipsisOne" style="cursor:pointer;color:#406eff;" @click="toDetail(scope.row)">{{ scope.row.contractName || '--' }}</div>
                  </el-tooltip>
                  <ToolTip v-else :content="getColumnName(scope.row.contractName, scope.row.projectName)" />
                </template>
              </u-table-column>
              <u-table-column :sortable="isAllTab?'custom':false" align="left" label="合同编号" min-width="130" prop="contractCode">
                <template slot-scope="scope">
                  <ToolTip :content="getColumnName(scope.row.contractCode, scope.row.contractNum)" />
                </template>
              </u-table-column>
              <u-table-column align="left" label="合同类型" min-width="135">
                <template slot-scope="scope">
                  <el-tooltip v-if="scope.row.contractType || scope.row.contractType === 0 " :open-delay="800" class="ellipsisOne" placement="top" effect="dark">
                    <div slot="content" style="max-width: 200px;">{{ scope.row.contractType | contractType }}</div>
                    <div class="ellipsisOne">{{ scope.row.contractType | contractType }}</div>
                  </el-tooltip>
                  <div v-else>--</div>
                </template>
              </u-table-column>
              <template v-if="isAllTab">
                <u-table-column align="left" label="签约对方" min-width="120">
                  <template slot-scope="scope">
                    <el-tooltip :open-delay="800" placement="top" effect="dark">
                      <div slot="content" style="max-width: 200px;">{{ scope.row.oppCompany || '--' }}</div>
                      <div class="ellipsisOne">{{ scope.row.oppCompany || '--' }}</div>
                    </el-tooltip>
                  </template>
                </u-table-column>
                <u-table-column align="left" label="我方签约主体" min-width="120">
                  <template slot-scope="scope">
                    <ToolTip :content="scope.row.subjectName"/>
                  </template>
                </u-table-column>
                <u-table-column align="left" label="合作方式" width="100">
                  <template slot-scope="scope">
                    {{ scope.row.contractDate | mapOptions(options.dateTypeOptions) }}
                  </template>
                </u-table-column>
                <u-table-column :sortable="isSelectedTab?false:'custom'" align="left" label="合同日期" width="210" prop="contractEffectEndDate">
                  <template slot-scope="scope">
                    <el-tooltip :open-delay="800" placement="top" effect="dark">
                      <div slot="content" style="max-width: 220px; white-space: nowrap; padding: 0 10px;">
                        <span v-if="scope.row.contractDate === 1 || scope.row.contractDate === null">{{ scope.row.contractEffectStartDate/1000 | standardFormatNoHour('YYYY/MM/DD', '--') }} {{ handleLimit(scope.row) }} {{ scope.row.contractEffectEndDate/1000 | standardFormatNoHour('YYYY/MM/DD', '--') }}</span>
                        <span v-else>{{ scope.row.pushTime/1000 | standardFormatNoHour('YYYY/MM/DD', '--') }}</span>
                      </div>
                      <div class="ellipsisOne">
                        <span v-if="scope.row.contractDate === 1 || scope.row.contractDate === null">{{ scope.row.contractEffectStartDate/1000 | standardFormatNoHour('YYYY/MM/DD', '--') }} {{ handleLimit(scope.row) }} {{ scope.row.contractEffectEndDate/1000 | standardFormatNoHour('YYYY/MM/DD', '--') }}</span>
                        <span v-else>{{ scope.row.pushTime/1000 | standardFormatNoHour('YYYY/MM/DD', '--') }}</span>
                      </div>
                    </el-tooltip>
                  </template>
                </u-table-column>
                <u-table-column v-if="isinSupplier" align="left" label="待审批角色" width="150">
                  <template slot-scope="scope">
                    <ToolTip :content="scope.row.reviewRole"/>
                  </template>
                </u-table-column>
                <u-table-column :sortable="isSelectedTab?false:'custom'" align="left" label="审批进度" min-width="120" prop="lastAuditTime">
                  <template slot-scope="scope">
                    {{ scope.row.reviewProgress || '--' }}
                  </template>
                </u-table-column>
              </template>
              <u-table-column align="left" label="申请人" min-width="120">
                <template slot-scope="scope">
                  <CheckUserInfo v-if="scope.row.proposer" :label="scope.row.proposerName || scope.row.proposer" :user-id="scope.row.proposerId" />
                  <div v-else>--</div>
                </template>
              </u-table-column>
              <u-table-column align="left" label="申请人部门" min-width="120">
                <template slot-scope="scope">
                  <el-tooltip v-if="scope.row.department || scope.row.proposerDepartmentName" :open-delay="800" placement="top" effect="dark">
                    <div slot="content" style="max-width: 200px;">{{ scope.row.proposerDepartmentName || scope.row.department || '--' }}</div>
                    <div class="ellipsisOne">{{ scope.row.proposerDepartmentName || scope.row.department || '--' }}</div>
                  </el-tooltip>
                  <span v-else>--</span>
                </template>
              </u-table-column>
              <u-table-column align="left" label="创建人" min-width="120">
                <template slot-scope="scope">
                  <CheckUserInfo v-if="scope.row.creator" :label="scope.row.creator" :user-id="scope.row.creatorId" />
                  <div v-else>--</div>
                </template>
              </u-table-column>
            </u-table>
          </template>
          <div v-else style="margin-bottom: 24px;text-align: center;">
            <empty-placeholder :text="emptyText" />
            <span v-if="isAllTab && isShowOther">智能提示：切换至【不可见合同】可搜索无权限查看的合同噢~</span>
          </div>
        </div>
        <el-row v-if="showMobilePage" type="flex" justify="left">
          <el-pagination
            v-if="isAllTab"
            v-show="list.total > 0"
            :current-page="list.page"
            :page-size="list.perPage"
            :total="list.total"
            :page-sizes="[20, 50, 100, 250, 500]"
            :layout="pageLayout"
            :small="true"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange" />
          <el-pagination
            v-if="curTabName == 'selected'"
            v-show="selectedData.length > 0"
            :current-page="selectedPage"
            :page-size="selectedPerPage"
            :total="selectedData.length"
            :page-sizes="[20, 50, 100, 250, 500]"
            :layout="pageLayout"
            :small="true"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange" />
        </el-row>
        <fixed-pagination v-if="isAllTab || isOtherTab" class="bottom-pagination">
          <div class="delete-button-container">
            <template v-if="!hideSelectTab">
              <el-button :disabled="!multiple && !singleSelect.id || multiple && !hasSeleted" size="small" type="primary" class="related-btn" @click="confirmRelatedContract">关联合同</el-button>
              <el-button size="small" plain type="primary" class="related-btn" @click="onBackClick">返回</el-button>
            </template>
            <div v-if="isOtherTab" class="tip">搜索他人合同最多展示10条</div>
          </div>
          <el-pagination
            v-if="!showMobilePage && isAllTab"
            v-show="list.total > 0"
            :current-page="list.page"
            :page-size="list.perPage"
            :total="list.total"
            :page-sizes="[20, 50, 100, 250, 500]"
            :layout="showMobilePage ? pageLayout : 'total, prev, pager, next, sizes, jumper'"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange" />
        </fixed-pagination>
        <fixed-pagination v-if="curTabName == 'selected'" class="bottom-pagination">
          <div class="delete-button-container">
            <el-button :disabled="!hasSeleted" size="small" type="primary" class="related-btn" @click="confirmRelatedContract">{{ confirmText }}</el-button>
            <el-button size="small" plain type="primary" class="related-btn" @click="onBackClick">返回</el-button>
          </div>
          <el-pagination
            v-if="!showMobilePage"
            v-show="selectedData.length > 0"
            :current-page="selectedPage"
            :page-size="selectedPerPage"
            :total="selectedData.length"
            :page-sizes="[20, 50, 100, 250, 500]"
            :layout="showMobilePage ? pageLayout : 'total, prev, pager, next, sizes, jumper'"
            @size-change="handleSizeChange"
            @current-change="handleCurrentChange" />
        </fixed-pagination>
      </div>
    </div>
  </el-drawer>
</template>

<script>
import { getList } from '@/api/legal';
import { getDepartmentAll } from '@/api/config';
import { getIssueOurTitleList } from '@/api/issueInvoice';
import { encryption } from '@/utils';

import { paramsRangeFormat, paramsAryToStr } from '@/utils/paramsFormat';
import tableSelections from '@/mixins/tableSelections';
import { standardFormatNoHour } from '@/filters/date';
import { moneyFilter } from '@/filters/number';
import { getDeptFullName } from '@/filters/dept';
import { mapOptions } from '@/filters';
import { contractType } from '@/filters/status';
import TableAdaptive from '@/mixins/tableAdaptive';
import options from '@/views/legal/module/options';
import EmptyPlaceholder from '@/components/EmptyPlaceholder';
import ResourceInfo from '@/components/ResourceInfo';
import PlatformIcon from '@/components/Common/platformIcon';
import FilterInput from '@/components/Tool/filter';
import axios from 'axios';
import { mapState } from 'vuex';
import mobileTable from '@/mixins/mobileTable';

export default {
  name: 'RelatedContract',
  filters: {
    standardFormatNoHour,
    getDeptFullName,
    moneyFilter,
    contractType,
    mapOptions
  },
  components: {
    FilterInput,
    EmptyPlaceholder,
    ResourceInfo,
    PlatformIcon
  },
  mixins: [tableSelections, TableAdaptive, mobileTable],
  props: {
    title: {
      type: String,
      default: '选择合同'
    },
    multiple: {
      type: Boolean,
      default: true
    },
    excludeCancel: {
      type: Boolean,
      default: false
    },
    confirmText: {
      type: String,
      default: '关联合同'
    },
    isShowOther: {
      type: Boolean,
      default: false
    },
    formMakeElement: { // 如果不为null，代表是自定义审批的关联
      type: Object,
      default: null
    },
    hideSelectTab: {
      type: Boolean,
      default: false
    },
    showFilterOppCompanyId: {
      type: Boolean,
      default: false
    },
    expandParams: {
      type: Object,
      default: null
    },
    exitSnapshot: {// 是否存在快照数据
      type: Boolean,
      default: false
    }
  },
  data() {
    return {
      filterInput: {},
      otherFilterInput: {},
      singleSelect: {
        id: ''
      }, // 单选
      page: 1,
      perPage: 20,
      list: {
        items: [],
        page: 1,
        perPage: 20,
        total: 0
      },
      selectedPage: 1,
      selectedPerPage: 20,
      sortType: '',
      sortName: '',
      listLoading: false,
      options,
      idKey: 'id', // 多选框参数
      isUmyTable: true,
      tableRefName: 'legalTableRef',
      curTabName: 'all',
      deptTreeList: [],
      selectedData: [],
      otherList: [],
      rangeKeyArr: [{
        attr: 'contractEffectDate',
        start: 'contractEffectStartDate',
        end: 'contractEffectEndDate',
        type: 'round'
      }, {
        attr: 'contractAmount',
        start: 'contractAmountMin',
        end: 'contractAmountMax',
        type: 'moneyFixedTwo'
      }],
      updateId: null,
      cancelToken: null,
      subjectOptions: [],
      snapshotData: []
    };
  },
  computed: {
    ...mapState({
      'showMobilePage': state => state.app.showMobilePage
    }),
    tableOutsideHeight() {
      return this.multiple ? (this.showMobilePage ? 270 : 206) : 175;
    },
    isOtherTab() {
      return this.curTabName === 'other';
    },
    isAllTab() {
      return this.curTabName === 'all';
    },
    isSelectedTab() {
      return this.curTabName === 'selected';
    },
    hasSeleted() {
      return this.multipleSelectionAll.length > 0;
    },
    isinSupplier() {
      return ['supplierCreate', 'supplierDetail'].includes(this.$route.name);
    },
    emptyText() {
      if (this.isAllTab) {
        return '找不到合同，请换个关键词搜索';
      } else if (this.isOtherTab) {
        return '搜索项目名称、合同编号等可查找他人合同';
      }
      return '暂无数据';
    },
    filterList() {
      const arr = [
        { keyword: 'contractCode', name: '合同编号', type: 'input', labelWidth: '99px' },
        { keyword: 'contractName', name: '项目名称', type: 'input', labelWidth: '99px' },
        { keyword: 'proposer', name: '申请人', type: 'input', labelWidth: '99px' },
        { keyword: 'creator', name: '创建人', type: 'input', labelWidth: '99px' },
        { keyword: 'departmentIdList', name: '申请人部门', type: 'cascaderSelectWithChild', childrenVal: 'children', options: this.deptTreeList },
        { keyword: 'contractType', name: '合同类型', type: 'select', options: [...options.typeOptions] },
        { keyword: 'contractAmount', name: '合同金额', labelWidth: '99px', type: 'inputRange', isRequired: true, startPlaceholder: '最低金额', endPlaceholder: '最高金额', max: 999999999 }
      ];
      if (this.showFilterOppCompanyId) {
        arr.push({ keyword: 'oppCompanyId', name: '签约对方Id', type: 'input', labelWidth: '99px' });
      }
      if (!this.isOtherTab) {
        arr.push({ keyword: 'oppCompany', name: '签约对方', type: 'input', labelWidth: '99px' });
        arr.push({ keyword: 'contractSubject', name: '我方签约主体', type: 'select', options: this.subjectOptions, placeholder: '签约主体' });
        arr.push({ keyword: 'contractDate', name: '合作方式', type: 'select', options: [...options.dateTypeOptions] });
        arr.push({ keyword: 'contractEffectDate', name: '合同有效期', type: 'rangeDate', timeType: 'daterange', labelWidth: '99px' });
      }
      return arr;
    },
    selectedTableData() {
      return this.selectedData.slice((this.selectedPage - 1) * this.selectedPerPage, this.selectedPage * this.selectedPerPage);
    },
    paramsObj: {
      get() {
        if (this.isOtherTab) return this.otherFilterInput;
        return this.filterInput;
      },
      set(data) {
        if (this.isOtherTab) {
          this.otherFilterInput = data;
        } else {
          this.filterInput = data;
        }
      }
    },
    singleSelectId: {
      get() {
        return this.singleSelect.id;
      },
      set(id) {
        //
      }
    }
  },
  created() {
    this.getSubJectOptions();
  },
  methods: {
    getColumnName(name1, name2) {
      return name2 || name1;
    },
    getSubJectOptions() {
      this.subjectOptions = [];
      getIssueOurTitleList().then(res => {
        if (res.code === 200) {
          res.data.forEach(item => {
            this.subjectOptions.push({
              value: item.id,
              label: item.name,
              isStringVal: true,
              name: '所属公司'
            });
          });
        }
      });
    },
    // 初始获取数据
    init(data) {
      this.curTabName = 'all';
      this.fetchData();
      this.queryDeptTreeList();
      this.singleSelect = data || {};
    },
    initSelectData(data = []) {
      this.selectedData = data;
      this.multipleSelectionAll = data;
      if (this.exitSnapshot) {
        this.snapshotData = JSON.parse(JSON.stringify(data.filter(i => !!i.id)));
      }
    },
    update(id) {
      this.updateId = id;
      this.fetchData();
    },
    updateItem() {
      const item = this.list.items.filter(el => el.id === this.updateId)[0];
      this.$emit('updateItem', item);
      this.updateId = null;
    },
    sortMethod(a) {
      if (!a.order) {
        this.sortName = '';
        this.sortType = '';
      } else {
        this.sortName = a.prop;
        this.sortType = a.order === 'ascending' ? 1 : -1;
      }
      if (this.curTabName === 'all') {
        this.fetchData();
      }
    },
    handleLimit(row) {
      if (!row.contractEffectEndDate && !row.contractEffectStartDate) {
        return '/';
      }
      return '-';
    },
    // fitter
    queryClick() {
      if (this.isSelectedTab) this.curTabName = 'all';
      if (this.isOtherTab) {
        for (const key of Object.keys(this.otherFilterInput)) {
          if (!this.otherFilterInput[key] && this.otherFilterInput[key] !== 0) {
            delete this.otherFilterInput[key];
          }
        }
        if (JSON.stringify(this.otherFilterInput) === '{}') {
          this.otherList = [];
          return;
        }
      }
      this.fetchData(true);
    },
    queryEmpty() {
      this.sortType = '';
      this.sortName = '';
      if (this.isOtherTab) {
        this.otherFilterInput = {};
      } else {
        this.filterInput = {};
      }
      this.queryClick();
    },
    // 翻页
    handleData(tableData) {
      return tableData.slice((this.selectedPage - 1) * this.selectedPerPage, this.selectedPage * this.selectedPerPage);
    },
    handleSizeChange(val) {
      if (this.curTabName === 'all') {
        this.perPage = val;
        this.fetchData(true);
      } else if (this.isSelectedTab) {
        this.selectedPerPage = val;
        this.setSelectRow(this.selectedTableData);
      }
    },
    handleCurrentChange(toPage) {
      if (this.curTabName === 'all') {
        this.page = toPage;
        this.fetchData();
      } else if (this.isSelectedTab) {
        this.selectedPage = toPage;
        this.setSelectRow(this.selectedTableData);
      }
    },
    // 获取列表数据
    fetchData(reset = false) {
      try {
        if (reset) this.page = 1;
        this.listLoading = true;
        const params = JSON.parse(JSON.stringify(this.paramsObj));
        params.page = this.isOtherTab ? 1 : this.page;
        params.perPage = this.isOtherTab ? 10 : this.perPage;
        if (!this.isOtherTab) {
          params.sortName = this.sortName;
          params.sortType = this.sortType;
        }

        params.handleStatus = -1;
        params.excludeProcess = 0; // 固定参数,过滤草稿状态的合同
        params.isOther = this.isOtherTab;
        paramsRangeFormat(this.rangeKeyArr, params);
        paramsAryToStr(['departmentIdList'], params);
        params.hasContractCode = true; // 只筛选已经生成合同编码的合同
        if (this.excludeCancel)params.excludeCancel = this.excludeCancel;
        if (this.cancelToken) this.cancelToken.cancel('cancel');
        const source = axios.CancelToken.source();
        this.cancelToken = source;
        if (this.formMakeElement) {
          params.fromProcess = 1;
          if (this.formMakeElement.options.presetFilterParams) {
            params.presetFilter = this.formMakeElement.options.presetFilterParams;
          }
        }
        if (this.expandParams) {
          Object.keys(this.expandParams).forEach(key => {
            if (key !== 'oppCompanyType' || (key === 'oppCompanyType' && params.oppCompanyId)) {
              params[key] = this.expandParams[key];
            }
          });
        }
        getList(params, source.token).then(({ data }) => {
          if (this.isOtherTab) { this.otherList = data.items; } else { this.list = data; }
          if (this.updateId) {
            this.updateItem();
          }
          this.listLoading = false;
          if (!this.isSelectedTab) this.setSelectRow(data.items);
          if (this.exitSnapshot && this.snapshotData.length) { // 最新内容替换快照数据
            const list = JSON.parse(JSON.stringify(this.snapshotData));
            list.forEach(j => {
              const findItem = data.items && data.items.find(i => i.id === j.id);
              if (findItem) {
                const snapshotIndex = this.snapshotData.findIndex(k => k.id === j.id);
                this.snapshotData.splice(snapshotIndex, 1);
                const selectIndex = this.multipleSelectionAll.findIndex(k => k.id === j.id);
                this.multipleSelectionAll[selectIndex] = findItem;
              }
            });
          }
        }, () => {
          this.listLoading = false;
        }).catch(e => {
          console.error(e);
        });
      } catch (error) {
        console.log(error);
      }
    },
    // 关联合同
    confirmRelatedContract() {
      const data = this.multiple ? this.selectedData : this.singleSelect;
      this.$emit('confirmRelatedContract', _.cloneDeep(data));
    },
    changeRadio(e, data) {
      this.singleSelect = data;
    },
    // 切换列表tab
    onSubActiveOrderChange(data) {
      if (data.paneName === 'all') {
        this.fetchData();
      } else if (data.paneName === 'other') {
        if (this.cancelToken) this.cancelToken.cancel('cancel');
        this.setSelectRow(this.otherList);
      }
      if (this.isSelectedTab) this.setSelectRow(this.selectedTableData);
    },
    // 保留数据
    tableSelectionChange(selection) {
      this.selectedData = selection;

      if (this.isSelectedTab) this.setSelectRow(this.selectedTableData);
    },
    // 申请部门列表
    queryDeptTreeList() {
      getDepartmentAll().then(res => {
        this.deptTreeList = (res && res.data) || [];
      }).catch(e => {
        console.log(e);
      });
    },
    // 跳转合同详情
    toDetail(row) {
      const routeUrl = this.$router.resolve({
        name: 'contractDetail',
        params: { id: encryption(row.id) },
        query: {
          processId: encryption(row.processId)
        }
      });
      window.open(routeUrl.href, '_blank');
    },
    onBackClick() {
      this.$refs.drawerBox.closeDrawer();
    },
    setParams(key, val) {
      this.$set(this.paramsObj, key, val);
      this.init();
    }
  }
};
</script>

<style scoped lang="scss">
::v-deep .el-drawer__header {
  height: 48px;
  padding: 0 12px 0 24px;
  margin: 0;
  box-shadow: 2px 4px 5px 0 rgba(221,225,234,0.3);
  display: flex;
  align-items: center;
  > span {
    font-size: 14px;
    color: #333;
  }
  ::v-deep .el-tabs__nav-wrap::after {
    height: 0 !important;
  }
}
::v-deep .el-tabs__header {
  margin: 0;
  border: none;
}
::v-deep .el-drawer__body {
  overflow-y: auto;
  margin-bottom: 56px;
}
::v-deep .el-drawer__header>span{
  font-size: 16px;
}
::v-deep .el-badge__content{
  background: #FB5227;
}
::v-deep .el-badge__content{
  transform: translateY(5px);
}
.tip {
  color: #999;
  font-size: 13px;
  margin-left: 20px;;
}
.drawer-content {
  padding: 22px 24px 0;
  overflow-y: auto;
  .table-list {
    &::v-deep {
     .el-table__header {
        .el-checkbox__inner {
          position: relative;
          left: -2px;
        }
      }
    }
    border-radius: 10px;
    .el-row {
      padding: 0;
    }
    .delete-button-container {
      flex:1;
      height: 32px;
      display: flex;
      align-items: center;
      .related-btn {
        margin-left: 20px;
        padding-left: 12px;
        padding-right: 12px;
      }
    }
    ::v-deep .pagination-flex {
      position: absolute;
      width: 100% !important;
    }
  }
}
::v-deep .el-tabs__nav-wrap::after {
  z-index: -1;
}
::v-deep .el-tabs__active-bar {
  bottom: 1px;
}
.contract-detail-tabs-container {
  &::v-deep {
    .el-tabs__header  {
      margin-bottom: 0 !important;
      border-bottom: 1px solid #ddd;
      .el-tabs__nav {
        border: none !important;
        height: 32px !important;
      }
      .el-tabs__item {
        padding: 0 12px !important;
        height: 32px !important;
        line-height: 32px !important;
        margin-right: 8px;
        border: 1px solid #ddd;
        border-radius: 4px 4px 0px 0px;
        color: #333;
        background: #f7f8fa;
        font-size: 16px;
        &:last-child {
          margin-right: 0px;
        }
        &.is-active {
          border-bottom-color: #FFFFFF !important;
          font-weight: bold;
          background: #fff;
          color: #406eff;
        }
      }
    }
  }
}
</style>
